package com.hjy.cabinet.ws.controller;

import com.hjy.cabinet.ws.domain.ws.WbsocketResponseBody;
import com.hjy.cabinet.ws.domain.ws.WebSocketRequest;
import com.hjy.cabinet.ws.service.WebsocketService;

public class RequestTestController {

    public WbsocketResponseBody synchronousRequest(String param) {
        WebSocketRequest webSocketRequest = WebSocketRequest.create("test", new Object[]{param}, "192.168.1.168");
        WebsocketService websocketService = WebsocketService.getInstance();
        WbsocketResponseBody wbsocketResponseBody = websocketService.sendMessageSynchronous(webSocketRequest);
        return wbsocketResponseBody;
    }

    public void aSynchronousRequest(String param) {
        WebSocketRequest webSocketRequest = WebSocketRequest.create("test", new Object[]{param}, "192.168.1.168");
        WebsocketService websocketService = WebsocketService.getInstance();
        websocketService.sendMessageAsynchronous(webSocketRequest);
    }
}
